const axios  = require('axios');


module.exports = function (data){
    return new Promise((success) => {
        axios({
            url : `http://${data.host}:${data.port}${data.url}`,
            method : data.method,
            data : data.data,
            headers: data.headers
        }).then(res => {
            success({
                success : true,
                code : data.code,
                data : res.data
            })
        }).catch(e => {
            success({
                success : false,
                code : data.code,
                data : e
            })
        })
    })
}